package part2;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Java5Ex6 Genericized version of Java5Ex2
 *   Example of an enhanced for loop
 * @author tony
 *
 */

public class Java5Ex6 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		List<String> list = new ArrayList<String>();
		list.add("Hello");
		list.add( "1" );
		list.add( "100" );
		list.add( "Goodbye" );
		/*
		 * Iterator for loop
		 */
		for (Iterator<String> i = list.iterator(); i.hasNext(); )
			System.out.println( i.next() );

		System.out.println( );
		/*
		 * Enhanced for loop
		 */
		for (String o : list )
			System.out.println( o );

	}

}
